$( document ).ready(function() {
	loadAssignment();
	init();
});

function loadAssignment() {
$.getJSON("listexercise.json",{ajax : 'true'},
	function(data) {
	var length = data.length;
	$('#lstConceptMaps').html('');
	for (var i = 0; i < length; i++) {
		$('#lstConceptMaps').append($('<option>', {
		    value: data[i].idConceptMaps,
		    text: data[i].nameConceptMaps,
		}));
	}
})
}

// Load Concept maps
function loadDraw() {
  var idConceptMaps  = $( "#lstConceptMaps" ).val();
  
  $.getJSON("loadconceptmapForExercise/" + idConceptMaps + ".json",{ajax : 'true'},
	function(data) {
	  var draw = data['jsonBean'];
	  var info = data['assignmentInfo'];
	  var json = {"class" :	"go.GraphLinksModel", 
			      "nodeDataArray": draw.nodeDataArray, "linkDataArray": draw.linkDataArray};
	   myDiagram.model = go.Model.fromJson(json);
	   $("#name").val(info.name);
   	   $("#assignee").val(info.owner);
   	   $("#createDate").val(info.startTime);
   	   $("#deadline").val(info.deadline);
	})
	  
}